/*
题目链接:https://leetcode.cn/problems/percentage-of-letter-in-string/description/?envType=daily-question&envId=2025-03-31
*/
//题解代码:
class Solution {
public:
    int percentageLetter(string s, char letter) {
        int cnt = 0,n = s.size();
        for(auto& c : s) cnt += c == letter;
        return ((double)cnt/n)*100;
    }
};
